<template>
	<view class="car-infos">
		<view class="title">车辆信息</view>
		<view class="grid">
			<view class="grid-item" v-if="info.powerType">
				<view class="label">动力类型</view>
				<view class="value">{{ info.powerType }}</view>
			</view>
			<view class="grid-item" v-if="info.continueMileage">
				<view class="label">车辆里程</view>
				<view class="value">{{ info.continueMileage }}</view>
			</view>
			<view class="grid-item" v-if="info.years">
				<view class="label">车辆年限</view>
				<view class="value">{{ info.years }}</view>
			</view>
			<view class="grid-item" v-if="info.chargingMode">
				<view class="label">充电模式</view>
				<view class="value">{{ info.chargingMode }}</view>
			</view>
			<view class="grid-item" v-if="info.gearbox">
				<view class="label">变速箱</view>
				<view class="value">{{ info.gearbox }}</view>
			</view>
			<view class="grid-item" v-if="info.level">
				<view class="label">车辆级别</view>
				<view class="value">{{ info.level }}</view>
			</view>
			<view class="grid-item" v-if="info.batteryType">
				<view class="label">电池类型</view>
				<view class="value">{{ info.batteryType }}</view>
			</view>
			<view class="grid-item" v-if="info.fineness">
				<view class="label">成色</view>
				<view class="value">{{ info.fineness }}</view>
			</view>
			<view class="grid-item" v-if="info.nature">
				<view class="label">车辆性质</view>
				<view class="value">{{ info.nature }}</view>
			</view>
		</view>
		<view class="more">
			<button class="cu-btn" @click="handMore">查看更多车辆参数</button>
		</view>
	</view>
</template>

<script setup>
	import {
		defineProps
	} from 'vue'
	const props = defineProps({
		info: {
			type: Object,
			default: () => {}
		}
	})
	const handMore = () => {
		uni.navigateTo({
			url: `/pagesA/car/parameter?id=${props.info.id}`
		})
	}
</script>

<style lang="scss" scoped>
	.car-infos {
		margin-top: 28rpx;
		padding: 24rpx;
		box-sizing: border-box;
		border-radius: 16rpx;
		background: #FFFFFF;

		.title {
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #333333;
		}

		.grid {
			margin-top: 30rpx;
			display: flex;
			flex-wrap: wrap;
			gap: 32rpx 15rpx;

			&-item {
				width: 200rpx;

				.label {
					font-size: 24rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #999999;
				}

				.value {
					margin-top: 10rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #333333;
				}
			}
		}

		.more {
			margin-top: 40rpx;
			padding-bottom: 10rpx;
			display: flex;
			justify-content: center;

			.cu-btn {
				width: 304rpx;
				height: 80rpx;
				background: #F5F5F5;
				border-radius: 12rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
			}
		}
	}
</style>